package com.example.myapplication.RoomFile

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

class WordViewModel(application: Application) : AndroidViewModel(application) {
    lateinit var data: LiveData<List<Word>>
    lateinit var repository: WordRepository
    init {
        repository = WordRepository(application)
        data = repository.liveData
    }
    fun insertWords(vararg words: Word){
        repository.insertWords(*words)
    }
    fun updateWords(word: Word){
        repository.updateWords(word)
    }
    fun deleteAll(){
        repository.deleteAll()
    }
    fun deleteWords(vararg word: Word){
        repository.deleteWords(*word)
    }
}